/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.chart.ARental;
import com.thor.palmmall.spi.chart.SRental;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class ARentalConverter implements Converter<SRental, ARental> {

  public static ARentalConverter getInstance() {
    if (instance == null)
      instance = new ARentalConverter();
    return instance;
  }

  private static ARentalConverter instance;

  private ARentalConverter() {
  }

  @Override
  public ARental convert(SRental source) {
    if (source == null) {
      return null;
    }
    ARental target = new ARental();
    target.setArea(source.getArea());
    target.setCategory(UCN.newInstance(source.getCategory()));
    return target;
  }

}
